package com.scs.application.modules.cfg.sync.impl;

import com.scs.application.modules.cfg.adapter.ParameterAdapter;
import com.scs.application.modules.cfg.sync.ParamSyncService;
import com.scs.application.modules.sys.properties.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:同步参数实现类
 */
@Service
public class ParamSyncServiceImpl implements ParamSyncService
{

    @Autowired
    private SystemProperties systemProperties;

    @Autowired
    private ParameterAdapter parameterAdapter;

    public void syncParameters() {
        /*ParameterService parameterService = parameterAdapter.getParameterService(true);
        List<Parameter> fileParameters = parameterService.list();
        if (fileParameters == null || fileParameters.isEmpty()) {
            return;
        }

        List<Parameter> parameters = parameterAdapter.getParameterService().list();
        for (Parameter parameter : fileParameters) {
            if (!parameters.stream().anyMatch(param -> parameter.getParamKey().equalsIgnoreCase(param.getParamKey()))) {
                Parameter param = new Parameter();
                BeanUtils.copyProperties(parameter, param);
                parameterAdapter.getParameterService().saveOrUpdate(param);
            }
        }*/

        parameterAdapter.getParameterService(true).refreshCache();
    }
}
